home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / pnl006.zip / DRAW_PCS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-03-17  |  17KB  |  525 lines

  1. { Draw_Pcs.Pas -- Pieces drawing unit for 146-10, The Pascal Team }
  2.  
  3. { Contains all piece drawing procedures, as well as a procedure to
  4.   draw a blank square and the entire board (with the starting positions) }
  5.  
  6. { Author : Mark A. Friedman }
  7.  
  8. unit
  9.     Draw_Pcs;
  10.  
  11. interface
  12.  
  13. Uses
  14.     Crt,Graph,Globals ;
  15.  
  16.     Procedure    Draw_Square  (xFile:char;Rank:integer) ;
  17.     Procedure    Draw_Pawn     (xFile:char;Rank:integer;Color:integer) ;
  18.     Procedure    Draw_Rook     (xFile:char;Rank:integer;Color:integer) ;
  19.     Procedure    Draw_Knight  (xFile:char;Rank:integer;Color:integer) ;
  20.     Procedure    Draw_Bishop  (xFile:char;Rank:integer;Color:integer) ;
  21.     Procedure    Draw_Queen   (xFile:char;Rank:integer;Color:integer) ;
  22.     Procedure    Draw_King     (xFile:char;Rank:integer;Color:integer) ;
  23.  
  24.     Procedure    Draw_Board   (Game_State:Game_State_Type) ;
  25.  
  26. implementation
  27.  
  28. { ------------------------------------------------------------- }
  29.  
  30. Procedure Draw_Square
  31.           (  xFile : char      ; {* file letter *}
  32.               Rank  : integer ) ; {* rank number *}
  33.     {
  34.         Draw a square, pixel by pixel onto a 30 deep by 35 wide matrix.
  35.         The square colors are set globally by constants.
  36.     }
  37.  
  38. Var
  39.     Col,Row : integer ;  {* coordinates *}
  40.     c,r     : integer ;  {* counters *}
  41.     color   : integer ;  {* color constant *}
  42.  
  43. begin
  44.     {* Convert input coordinates into screen coordinates *}
  45.  
  46.         Row := Convert_File(xFile) ; Col := Convert_Rank(Rank) ;
  47.  
  48.     {* Draw square *}
  49.  
  50.         If (    (xFile in ['b','d','f','h']) and
  51.             (odd(Rank)                 ) or
  52.            ( (xFile in ['a','c','e','g']) and
  53.             (odd(Rank+1)              )) )
  54.         then
  55.             color := White_S
  56.         else
  57.             color := Black_S ;
  58.  
  59.                 SetLineStyle(0,0,1);
  60.                 SetColor(Color);
  61.  
  62.         For r := 1 to 29 do
  63.                    Line(Col+1, Row+r, Col+34, Row+ r);
  64.                 color := brown;
  65.                 setcolor(brown);
  66.                 Rectangle(Col, Row, Col+35, Row+30);
  67.  
  68.     {* Draw border *}
  69.  
  70. {        For c := 0 to 34 do    PutPixel(Col+ c, Row   , brown);
  71.         For c := 0 to 34 do    PutPixel(Col+ c, Row+30, brown);
  72.         For r := 0 to 29 do    PutPixel(Col   , Row+ r, brown);
  73.         For r := 0 to 29 do    PutPixel(Col+35, Row+ r, brown);
  74. }
  75. end; {* Draw_Square *}
  76.  
  77.  
  78. { ------------------------------------------------------------- }
  79.  
  80. Procedure Draw_Pawn
  81.  
  82.         (  XFile   : char      ; {* file letter *}
  83.            Rank    : integer   ; {* rank number *}
  84.            Color   : integer ) ; {* piece color *}
  85.     {
  86.         Draw a pawn, pixel by pixel onto a 30 deep by 35 wide matrix.
  87.         The piece colors are set globally by constants.
  88.     }
  89.  
  90. Var
  91.     Row,Col    : integer ;  {* Upper left bounds *}
  92.     r  ,c        : integer ;  {* counters *}
  93.  
  94. begin
  95.     {* Convert input coordinates into screen coordinates *}
  96.  
  97.         Row := Convert_File(XFile) ; Col := Convert_Rank(Rank) ;
  98.  
  99.         SetColor(Color) ; SetLineStyle(SolidLn, 0, NormWidth) ;
  100.  
  101.         Line(Col+16, Row+ 2, Col+18, Row+ 2) ;
  102.         Line(Col+14, Row+ 3, Col+20, Row+ 3) ;
  103.         Line(Col+13, Row+ 4, Col+21, Row+ 4) ;
  104.         Line(Col+12, Row+ 5, Col+22, Row+ 5) ;
  105.         Line(Col+12, Row+ 6, Col+22, Row+ 6) ;
  106.         Line(Col+13, Row+ 7, Col+21, Row+ 7) ;
  107.         Line(Col+14, Row+ 8, Col+20, Row+ 8) ;
  108.         Line(Col+15, Row+ 9, Col+19, Row+ 9) ;
  109.         Line(Col+15, Row+10, Col+19, Row+10) ;
  110.         Line(Col+12, Row+11, Col+22, Row+11) ;
  111.         Line(Col+11, Row+12, Col+23, Row+12) ;
  112.         Line(Col+12, Row+13, Col+22, Row+13) ;
  113.         Line(Col+15, Row+14, Col+19, Row+14) ;
  114.         Line(Col+14, Row+15, Col+20, Row+15) ;
  115.         Line(Col+14, Row+16, Col+20, Row+16) ;
  116.         Line(Col+14, Row+17, Col+20, Row+17) ;
  117.         Line(Col+14, Row+18, Col+20, Row+18) ;
  118.         Line(Col+14, Row+19, Col+20, Row+19) ;
  119.         Line(Col+13, Row+20, Col+21, Row+20) ;
  120.         Line(Col+13, Row+21, Col+21, Row+21) ;
  121.         Line(Col+13, Row+22, Col+21, Row+22) ;
  122.         Line(Col+ 5, Row+23, Col+29, Row+23) ;
  123.         Line(Col+ 4, Row+24, Col+30, Row+24) ;
  124.         Line(Col+ 4, Row+25, Col+30, Row+25) ;
  125.         Line(Col+ 4, Row+26, Col+30, Row+26) ;
  126.         Line(Col+ 5, Row+27, Col+29, Row+27) ;
  127.  
  128. end; {* Draw_Pawn *}
  129.  
  130. { ------------------------------------------------------------- }
  131.  
  132. Procedure Draw_Rook
  133.  
  134.         (  XFile   : char      ; {* file letter *}
  135.            Rank    : integer   ; {* rank number *}
  136.            Color   : integer ) ; {* piece color *}
  137.  
  138.     {
  139.         Draw a rook, pixel by pixel onto a 30 deep by 35 wide matrix.
  140.         The piece colors are set globally by constants.
  141.     }
  142.  
  143. Var
  144.     Row,Col    : integer ;    {* Upper left bounds *}
  145.     c  ,r     : integer ; {* counters *}
  146.  
  147. begin
  148.     {* Convert input coordinates into screen coordinates *}
  149.  
  150.         Row := Convert_File(XFile) ; Col := Convert_Rank(Rank) ;
  151.  
  152.     {* Draw piece *}
  153.  
  154.         SetColor(Color) ; SetLineStyle(SolidLn, 0, NormWidth) ;
  155.  
  156.         Line(Col+ 5, Row+ 2, Col+ 9, Row+ 2) ;
  157.         Line(Col+15, Row+ 2, Col+19, Row+ 2) ;
  158.         Line(Col+25, Row+ 2, Col+29, Row+ 2) ;
  159.         Line(Col+ 5, Row+ 3, Col+ 9, Row+ 3) ;
  160.         Line(Col+15, Row+ 3, Col+19, Row+ 3) ;
  161.         Line(Col+25, Row+ 3, Col+29, Row+ 3) ;
  162.         Line(Col+ 5, Row+ 4, Col+ 9, Row+ 4) ;
  163.         Line(Col+15, Row+ 4, Col+19, Row+ 4) ;
  164.         Line(Col+25, Row+ 4, Col+29, Row+ 4) ;
  165.         Line(Col+ 5, Row+ 5, Col+ 9, Row+ 5) ;
  166.         Line(Col+15, Row+ 5, Col+19, Row+ 5) ;
  167.         Line(Col+25, Row+ 5, Col+29, Row+ 5) ;
  168.         Line(Col+ 5, Row+ 6, Col+29, Row+ 6) ;
  169.         Line(Col+ 5, Row+ 7, Col+29, Row+ 7) ;
  170.         Line(Col+ 5, Row+ 8, Col+29, Row+ 8) ;
  171.         Line(Col+ 6, Row+ 9, Col+28, Row+ 9) ;
  172.         Line(Col+ 7, Row+10, Col+27, Row+10) ;
  173.         Line(Col+10, Row+11, Col+24, Row+11) ;
  174.         Line(Col+10, Row+12, Col+24, Row+12) ;
  175.         Line(Col+10, Row+13, Col+24, Row+13) ;
  176.         Line(Col+10, Row+14, Col+24, Row+14) ;
  177.         Line(Col+10, Row+15, Col+24, Row+15) ;
  178.         Line(Col+10, Row+16, Col+24, Row+16) ;
  179.         Line(Col+10, Row+17, Col+24, Row+17) ;
  180.         Line(Col+10, Row+18, Col+24, Row+18) ;
  181.         Line(Col+10, Row+19, Col+24, Row+19) ;
  182.         Line(Col+10, Row+20, Col+24, Row+20) ;
  183.         Line(Col+ 9, Row+21, Col+25, Row+21) ;
  184.         Line(Col+ 8, Row+22, Col+26, Row+22) ;
  185.         Line(Col+ 5, Row+23, Col+29, Row+23) ;
  186.         Line(Col+ 4, Row+24, Col+30, Row+24) ;
  187.         Line(Col+ 4, Row+25, Col+30, Row+25) ;
  188.         Line(Col+ 4, Row+26, Col+30, Row+26) ;
  189.         Line(Col+ 5, Row+27, Col+29, Row+27) ;
  190.  
  191. end; {* Draw_Rook *}
  192.  
  193. { ------------------------------------------------------------- }
  194.  
  195. Procedure Draw_Knight
  196.  
  197.         (  XFile   : char      ; {* file letter *}
  198.            Rank    : integer   ; {* rank number *}
  199.            Color   : integer ) ; {* piece color *}
  200.  
  201.     {
  202.         Draw a knight, pixel by pixel onto a 30 deep by 35 wide matrix.
  203.         The piece colors are set globally by constants.
  204.     }
  205.  
  206. Var
  207.     Row,Col    : integer ;    {* Upper left bounds *}
  208.     c  ,r     : integer ; {* counters *}
  209.  
  210. begin
  211.     {* Convert input coordinates into screen coordinates *}
  212.  
  213.         Row := Convert_File(XFile) ; Col := Convert_Rank(Rank) ;
  214.  
  215.     {* Draw piece *}
  216.  
  217.         SetColor(Color) ; SetLineStyle(SolidLn, 0, NormWidth) ;
  218.  
  219.         Line(Col+11, Row+ 2, Col+12, Row+ 2) ;
  220.         Line(Col+ 7, Row+ 3, Col+ 8, Row+ 3) ;
  221.         Line(Col+11, Row+ 3, Col+13, Row+ 3) ;
  222.         Line(Col+ 7, Row+ 4, Col+13, Row+ 4) ;
  223.         Line(Col+16, Row+ 4, Col+20, Row+ 4) ;
  224.         Line(Col+ 8, Row+ 5, Col+23, Row+ 5) ;
  225.         Line(Col+ 8, Row+ 6, Col+25, Row+ 6) ;
  226.         Line(Col+ 8, Row+ 7, Col+27, Row+ 7) ;
  227.         Line(Col+ 7, Row+ 8, Col+10, Row+ 8) ;
  228.         Line(Col+14, Row+ 8, Col+28, Row+ 8) ;
  229.         Line(Col+ 7, Row+ 9, Col+10, Row+ 9) ;
  230.         Line(Col+14, Row+ 9, Col+29, Row+ 9) ;
  231.         Line(Col+ 6, Row+10, Col+29, Row+10) ;
  232.         Line(Col+ 6, Row+11, Col+30, Row+11) ;
  233.         Line(Col+ 5, Row+12, Col+30, Row+12) ;
  234.         Line(Col+ 4, Row+13, Col+13, Row+13) ;
  235.         Line(Col+16, Row+13, Col+30, Row+13) ;
  236.         Line(Col+ 5, Row+14, Col+11, Row+14) ;
  237.         Line(Col+16, Row+14, Col+30, Row+14) ;
  238.         Line(Col+ 5, Row+15, Col+10, Row+15) ;
  239.         Line(Col+15, Row+15, Col+30, Row+15) ;
  240.         Line(Col+ 6, Row+16, Col+ 9, Row+16) ;
  241.         Line(Col+13, Row+16, Col+30, Row+16) ;
  242.         Line(Col+12, Row+17, Col+30, Row+17) ;
  243.         Line(Col+11, Row+18, Col+29, Row+18) ;
  244.         Line(Col+10, Row+19, Col+29, Row+19) ;
  245.         Line(Col+10, Row+20, Col+28, Row+20) ;
  246.         Line(Col+ 9, Row+21, Col+27, Row+21) ;
  247.         Line(Col+ 8, Row+22, Col+26, Row+22) ;
  248.         Line(Col+ 5, Row+23, Col+30, Row+23) ;
  249.         Line(Col+ 4, Row+24, Col+30, Row+24) ;
  250.         Line(Col+ 4, Row+25, Col+30, Row+25) ;
  251.         Line(Col+ 4, Row+26, Col+30, Row+26) ;
  252.         Line(Col+ 5, Row+27, Col+29, Row+27) ;
  253.  
  254. end; {* Draw_Knight *}
  255.  
  256. { ------------------------------------------------------------- }
  257.  
  258. Procedure Draw_Bishop
  259.  
  260.         (  XFile   : char      ; {* file letter *}
  261.            Rank    : integer   ; {* rank number *}
  262.            Color   : integer ) ; {* piece color *}
  263.  
  264.     {
  265.         Draw a bishop, pixel by pixel onto a 30 deep by 35 wide matrix.
  266.         The piece colors are set globally by constants.
  267.     }
  268.  
  269. Var
  270.     Row,Col    : integer ;    {* Upper left bounds *}
  271.     c  ,r     : integer ; {* counters *}
  272.  
  273. begin
  274.     {* Convert input coordinates into screen coordinates *}
  275.  
  276.         Row := Convert_File(XFile) ; Col := Convert_Rank(Rank) ;
  277.  
  278.     {* Draw piece *}
  279.  
  280.         SetColor(Color) ; SetLineStyle(SolidLn, 0, NormWidth) ;
  281.  
  282.         Line(Col+16, Row+ 2, Col+18, Row+ 2) ;
  283.         Line(Col+15, Row+ 3, Col+19, Row+ 3) ;
  284.         Line(Col+16, Row+ 4, Col+18, Row+ 4) ;
  285.         Line(Col+15, Row+ 5, Col+19, Row+ 5) ;
  286.         Line(Col+13, Row+ 6, Col+13, Row+ 6) ;
  287.         Line(Col+16, Row+ 6, Col+21, Row+ 6) ;
  288.         Line(Col+12, Row+ 7, Col+14, Row+ 7) ;
  289.         Line(Col+17, Row+ 7, Col+22, Row+ 7) ;
  290.         Line(Col+12, Row+ 8, Col+14, Row+ 8) ;
  291.         Line(Col+17, Row+ 8, Col+22, Row+ 8) ;
  292.         Line(Col+11, Row+ 9, Col+23, Row+ 9) ;
  293.         Line(Col+11, Row+10, Col+23, Row+10) ;
  294.         Line(Col+11, Row+11, Col+23, Row+11) ;
  295.         Line(Col+11, Row+12, Col+23, Row+12) ;
  296.         Line(Col+12, Row+13, Col+22, Row+13) ;
  297.         Line(Col+12, Row+14, Col+22, Row+14) ;
  298.         Line(Col+13, Row+15, Col+21, Row+15) ;
  299.         Line(Col+14, Row+16, Col+20, Row+16) ;
  300.         Line(Col+15, Row+17, Col+19, Row+17) ;
  301.         Line(Col+16, Row+18, Col+18, Row+18) ;
  302.         Line(Col+13, Row+19, Col+21, Row+19) ;
  303.         Line(Col+13, Row+20, Col+21, Row+20) ;
  304.         Line(Col+16, Row+21, Col+18, Row+21) ;
  305.         Line(Col+16, Row+22, Col+18, Row+22) ;
  306.         Line(Col+ 5, Row+23, Col+29, Row+23) ;
  307.         Line(Col+ 4, Row+24, Col+30, Row+24) ;
  308.         Line(Col+ 4, Row+25, Col+30, Row+25) ;
  309.         Line(Col+ 4, Row+26, Col+30, Row+26) ;
  310.         Line(Col+ 5, Row+27, Col+29, Row+27) ;
  311.  
  312. end; {* Draw_Bishop *}
  313.  
  314. { ------------------------------------------------------------- }
  315.  
  316. Procedure Draw_Queen
  317.  
  318.         (  XFile   : char      ; {* file letter *}
  319.            Rank    : integer   ; {* rank number *}
  320.            Color   : integer ) ; {* piece color *}
  321.  
  322.     {
  323.         Draw a queen, pixel by pixel onto a 30 deep by 35 wide matrix.
  324.         The piece colors are set globally by constants.
  325.     }
  326.  
  327. Var
  328.     Row,Col    : integer ;    {* Upper left bounds *}
  329.     c  ,r     : integer ; {* counters *}
  330.  
  331. begin
  332.     {* Convert input coordinates into screen coordinates *}
  333.  
  334.         Row := Convert_File(XFile) ; Col := Convert_Rank(Rank) ;
  335.  
  336.     {* Draw piece *}
  337.  
  338.         SetColor(Color) ; SetLineStyle(SolidLn, 0, NormWidth) ;
  339.  
  340.         Line(Col+ 4, Row+ 3, Col+ 6, Row+ 3) ;
  341.         Line(Col+12, Row+ 3, Col+14, Row+ 3) ;
  342.         Line(Col+20, Row+ 3, Col+22, Row+ 3) ;
  343.         Line(Col+28, Row+ 3, Col+30, Row+ 3) ;
  344.         Line(Col+ 3, Row+ 4, Col+ 7, Row+ 4) ;
  345.         Line(Col+11, Row+ 4, Col+15, Row+ 4) ;
  346.         Line(Col+19, Row+ 4, Col+23, Row+ 4) ;
  347.         Line(Col+27, Row+ 4, Col+31, Row+ 4) ;
  348.         Line(Col+ 3, Row+ 5, Col+ 7, Row+ 5) ;
  349.         Line(Col+11, Row+ 5, Col+15, Row+ 5) ;
  350.         Line(Col+19, Row+ 5, Col+23, Row+ 5) ;
  351.         Line(Col+27, Row+ 5, Col+31, Row+ 5) ;
  352.         Line(Col+ 4, Row+ 6, Col+ 6, Row+ 6) ;
  353.         Line(Col+12, Row+ 6, Col+14, Row+ 6) ;
  354.         Line(Col+20, Row+ 6, Col+22, Row+ 6) ;
  355.         Line(Col+28, Row+ 6, Col+30, Row+ 6) ;
  356.         Line(Col+ 5, Row+ 7, Col+ 5, Row+ 7) ;
  357.         Line(Col+13, Row+ 7, Col+13, Row+ 7) ;
  358.         Line(Col+21, Row+ 7, Col+21, Row+ 7) ;
  359.         Line(Col+29, Row+ 7, Col+29, Row+ 7) ;
  360.         Line(Col+ 4, Row+ 8, Col+ 7, Row+ 8) ;
  361.         Line(Col+12, Row+ 8, Col+15, Row+ 8) ;
  362.         Line(Col+19, Row+ 8, Col+22, Row+ 8) ;
  363.         Line(Col+27, Row+ 8, Col+30, Row+ 8) ;
  364.         Line(Col+ 4, Row+ 9, Col+ 7, Row+ 9) ;
  365.         Line(Col+12, Row+ 9, Col+15, Row+ 9) ;
  366.         Line(Col+19, Row+ 9, Col+22, Row+ 9) ;
  367.         Line(Col+27, Row+ 9, Col+30, Row+ 9) ;
  368.         Line(Col+ 5, Row+10, Col+ 8, Row+10) ;
  369.         Line(Col+12, Row+10, Col+15, Row+10) ;
  370.         Line(Col+19, Row+10, Col+22, Row+10) ;
  371.         Line(Col+26, Row+10, Col+29, Row+10) ;
  372.         Line(Col+ 5, Row+11, Col+ 8, Row+11) ;
  373.         Line(Col+13, Row+11, Col+15, Row+11) ;
  374.         Line(Col+19, Row+11, Col+21, Row+11) ;
  375.         Line(Col+26, Row+11, Col+29, Row+11) ;
  376.         Line(Col+ 6, Row+12, Col+ 9, Row+12) ;
  377.         Line(Col+13, Row+12, Col+15, Row+12) ;
  378.         Line(Col+19, Row+12, Col+21, Row+12) ;
  379.         Line(Col+25, Row+12, Col+28, Row+12) ;
  380.         Line(Col+ 6, Row+13, Col+ 9, Row+13) ;
  381.         Line(Col+13, Row+13, Col+15, Row+13) ;
  382.         Line(Col+19, Row+13, Col+21, Row+13) ;
  383.         Line(Col+25, Row+13, Col+28, Row+13) ;
  384.         Line(Col+ 7, Row+14, Col+10, Row+14) ;
  385.         Line(Col+14, Row+14, Col+16, Row+14) ;
  386.         Line(Col+18, Row+14, Col+20, Row+14) ;
  387.         Line(Col+24, Row+14, Col+27, Row+14) ;
  388.         Line(Col+ 8, Row+15, Col+10, Row+15) ;
  389.         Line(Col+14, Row+15, Col+16, Row+15) ;
  390.         Line(Col+18, Row+15, Col+20, Row+15) ;
  391.         Line(Col+24, Row+15, Col+26, Row+15) ;
  392.         Line(Col+ 8, Row+16, Col+11, Row+16) ;
  393.         Line(Col+14, Row+16, Col+20, Row+16) ;
  394.         Line(Col+23, Row+16, Col+26, Row+16) ;
  395.         Line(Col+ 9, Row+17, Col+25, Row+17) ;
  396.         Line(Col+ 9, Row+18, Col+25, Row+18) ;
  397.         Line(Col+ 9, Row+19, Col+25, Row+19) ;
  398.         Line(Col+ 9, Row+20, Col+25, Row+20) ;
  399.         Line(Col+13, Row+21, Col+21, Row+21) ;
  400.         Line(Col+13, Row+22, Col+21, Row+22) ;
  401.         Line(Col+ 5, Row+23, Col+29, Row+23) ;
  402.         Line(Col+ 4, Row+24, Col+30, Row+24) ;
  403.         Line(Col+ 4, Row+25, Col+30, Row+25) ;
  404.         Line(Col+ 4, Row+26, Col+30, Row+26) ;
  405.         Line(Col+ 5, Row+27, Col+29, Row+27) ;
  406.  
  407. end; {* Draw_Queen *}
  408.  
  409. { ------------------------------------------------------------- }
  410.  
  411. Procedure Draw_King
  412.  
  413.         (  XFile   : char      ; {* file letter *}
  414.            Rank    : integer   ; {* rank number *}
  415.            Color   : integer ) ; {* piece color *}
  416.  
  417.     {
  418.         Draw a king, pixel by pixel onto a 30 deep by 35 wide matrix.
  419.         The piece colors are set globally by constants.
  420.     }
  421.  
  422. Var
  423.     Row,Col    : integer ;    {* Upper left bounds *}
  424.     c  ,r     : integer ; {* counters *}
  425.  
  426. begin
  427.     {* Convert input coordinates into screen coordinates *}
  428.  
  429.         Row := Convert_File(XFile) ; Col := Convert_Rank(Rank) ;
  430.  
  431.     {* Draw piece *}
  432.  
  433.         SetColor(Color) ; SetLineStyle(SolidLn, 0, NormWidth) ;
  434.  
  435.         Line(Col+17, Row+ 2, Col+17, Row+ 2) ;
  436.         Line(Col+16, Row+ 3, Col+18, Row+ 3) ;
  437.         Line(Col+15, Row+ 4, Col+19, Row+ 4) ;
  438.         Line(Col+16, Row+ 5, Col+18, Row+ 5) ;
  439.         Line(Col+ 8, Row+ 6, Col+11, Row+ 6) ;
  440.         Line(Col+17, Row+ 6, Col+17, Row+ 6) ;
  441.         Line(Col+23, Row+ 6, Col+26, Row+ 6) ;
  442.         Line(Col+ 6, Row+ 7, Col+13, Row+ 7) ;
  443.         Line(Col+17, Row+ 7, Col+17, Row+ 7) ;
  444.         Line(Col+21, Row+ 7, Col+28, Row+ 7) ;
  445.         Line(Col+ 5, Row+ 8, Col+15, Row+ 8) ;
  446.         Line(Col+17, Row+ 8, Col+17, Row+ 8) ;
  447.         Line(Col+19, Row+ 8, Col+29, Row+ 8) ;
  448.         Line(Col+ 4, Row+ 9, Col+30, Row+ 9) ;
  449.         Line(Col+ 3, Row+10, Col+31, Row+10) ;
  450.         Line(Col+ 3, Row+11, Col+31, Row+11) ;
  451.         Line(Col+ 3, Row+12, Col+ 8, Row+12) ;
  452.         Line(Col+12, Row+12, Col+22, Row+12) ;
  453.         Line(Col+25, Row+12, Col+31, Row+12) ;
  454.         Line(Col+ 3, Row+13, Col+ 8, Row+13) ;
  455.         Line(Col+12, Row+13, Col+22, Row+13) ;
  456.         Line(Col+25, Row+13, Col+31, Row+13) ;
  457.         Line(Col+ 3, Row+14, Col+31, Row+14) ;
  458.         Line(Col+ 3, Row+15, Col+31, Row+15) ;
  459.         Line(Col+ 4, Row+16, Col+30, Row+16) ;
  460.         Line(Col+ 5, Row+17, Col+29, Row+17) ;
  461.         Line(Col+ 6, Row+18, Col+28, Row+18) ;
  462.         Line(Col+ 7, Row+19, Col+27, Row+19) ;
  463.         Line(Col+ 8, Row+20, Col+26, Row+20) ;
  464.         Line(Col+10, Row+21, Col+24, Row+21) ;
  465.         Line(Col+10, Row+22, Col+24, Row+22) ;
  466.         Line(Col+ 5, Row+23, Col+29, Row+23) ;
  467.         Line(Col+ 4, Row+24, Col+30, Row+24) ;
  468.         Line(Col+ 4, Row+25, Col+30, Row+25) ;
  469.         Line(Col+ 4, Row+26, Col+30, Row+26) ;
  470.         Line(Col+ 5, Row+27, Col+29, Row+27) ;
  471.  
  472. end; {* Draw_King *}
  473.  
  474. { ------------------------------------------------------------- }
  475.  
  476. Procedure    Draw_Board   (Game_State:Game_State_Type) ;
  477.  
  478.     {
  479.         Draw the board, square by square based on the current
  480.       Game state board positions.
  481.         The square colors are set globally by constants.
  482.     }
  483.  
  484. Var
  485.     XFile    : char    ;  {* File letter *}
  486.     Rank     : byte    ;  {* Rank number *}
  487.    color    : byte    ;  {* piece color *}
  488.  
  489. begin
  490.  
  491. with Game_State do
  492.   begin
  493.  
  494.         For XFile := 'a' to 'h' do
  495.             For Rank := 1 to 8 do
  496.                 begin
  497.                {* Determine piece color *}
  498.                If Board[xFile,Rank].Side = white
  499.                then
  500.                   color := White_P
  501.                else
  502.                   color := Black_P ;
  503.  
  504.                Draw_Square(xFile,Rank) ;
  505.  
  506.                Case (Board[xFile,Rank].Piece) of
  507.                   pawn   : Draw_Pawn   (xFile,Rank,color) ;
  508.                   rook   : Draw_Rook   (xFile,Rank,color) ;
  509.                   knight : Draw_Knight (xFile,Rank,color) ;
  510.                   bishop : Draw_Bishop (xFile,Rank,color) ;
  511.                   queen  : Draw_Queen  (xFile,Rank,color) ;
  512.                   king   : Draw_King   (xFile,Rank,color) ;
  513.                end;
  514.  
  515.                 end;
  516.  
  517.   end; {* with Game_State *}
  518.  
  519. end; {* Draw_Board *}
  520. { ------------------------------------------------------------- }
  521.  
  522. Begin {* Main *}
  523. End.  {* Main *}
  524. 
  525.